package com.qf.git2204.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

@RestController
@RequestMapping("/test")
public class TestController {


    /**
     * mvc的收参方式之一，路径收参
     * @param name
     * @return
     */
    @GetMapping("/test1/{name}")
    public HashMap<String,Object> test1(@PathVariable("name") String name){

        System.out.println(name);
        HashMap<String, Object> map = new HashMap<>();
        map.put("code","1");
        map.put("msg",name);

        return map;
    }

}
